﻿<UserControl x:Class="VSTalk.Engine.View.NotificationControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:conerters="clr-namespace:VSTalk.Engine.Converters" mc:Ignorable="d"
             Height="0">
    <UserControl.Resources>
        <conerters:VisibilityIfCanExecuteConverter x:Key="VisibilityIfCanExecuteConverter"/>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="20"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="20"/>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="20"/>
            </Grid.ColumnDefinitions>
            <TextBlock  Grid.Column="0" 
                Text="{Binding CurrentNotification.Title}" FontWeight="Bold"/>
            <TextBlock Grid.Column="1" FontWeight="Bold">
                <TextBlock.Text>
                   <MultiBinding StringFormat="({0}/{1})">
                       <Binding Path="CurrentMessageIndex"/>
                       <Binding Path="Notifications.Messages.Count"/>
                   </MultiBinding>
                </TextBlock.Text>
            </TextBlock>
            <Button Grid.Column="2"
                Content="X" Command="{Binding HideControl}"/>
        </Grid>                
        <Label Grid.Row="1">
          <TextBlock Text="{Binding CurrentNotification.Message}" TextWrapping="Wrap"/>
        </Label>
        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <StackPanel Grid.Column="0" HorizontalAlignment="Left"
                        Orientation="Horizontal">
                <TextBlock>
                    <Hyperlink Command="{Binding GoToPrevMessage}">
                        Prev
                    </Hyperlink>
                    <Hyperlink Command="{Binding GoToNextMessage}" TargetName="Next">
                        Next
                    </Hyperlink>
                </TextBlock>
            </StackPanel>
            <StackPanel Grid.Column="1" HorizontalAlignment="Right"
                    Orientation="Horizontal">
                <Button Content="Ok" Command="{Binding ConfirmCommand}"/>
                <Button Content="Cancel" Command="{Binding RejectCommand}"
                        Visibility="{Binding Path=IsEnabled, RelativeSource={RelativeSource Self}, Mode=OneWay, 
                        Converter={StaticResource VisibilityIfCanExecuteConverter}}"/>
            </StackPanel>
        </Grid>
    </Grid>
</UserControl>
